package com.ppx.life.controller;

import com.ppx.life.dao.Bill;
import com.ppx.life.dao.vo.Conversation;
import com.ppx.life.service.BillService;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@RequestMapping("/v1/")
@Controller
public class MillController {

    @Autowired
    BillService billService;
    @RequestMapping("addBills")
    @ResponseBody
    public Conversation addBills(@RequestBody List<Bill> bills, Integer user_id){
        return new Conversation(billService.add(bills,user_id));
    }

    @RequestMapping("selectBillsList")
    @ResponseBody
    public Conversation selectBillsList(Integer user_id,Integer indexPage){
        return new Conversation(billService.selectBillsList(user_id,indexPage));
    }

    @RequestMapping("selectBillListByDate")
    @ResponseBody
    public Conversation selectBillListByDate(String date){
        return new Conversation(billService.selectBillListByDate(date));
    }

}
